/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package model.impl;

import model.ModelPackage;
import model.Serie;
import model.SeriesPackSerie;

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.NotificationChain;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.impl.EObjectImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Series Pack Serie</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link model.impl.SeriesPackSerieImpl#getSerie <em>Serie</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class SeriesPackSerieImpl extends AggregationImpl implements SeriesPackSerie {
	/**
	 * The cached value of the '{@link #getSerie() <em>Serie</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getSerie()
	 * @generated
	 * @ordered
	 */
	protected Serie serie;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected SeriesPackSerieImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return ModelPackage.Literals.SERIES_PACK_SERIE;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Serie getSerie() {
		if (serie != null && serie.eIsProxy()) {
			InternalEObject oldSerie = (InternalEObject)serie;
			serie = (Serie)eResolveProxy(oldSerie);
			if (serie != oldSerie) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, ModelPackage.SERIES_PACK_SERIE__SERIE, oldSerie, serie));
			}
		}
		return serie;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public Serie basicGetSerie() {
		return serie;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public NotificationChain basicSetSerie(Serie newSerie, NotificationChain msgs) {
		Serie oldSerie = serie;
		serie = newSerie;
		if (eNotificationRequired()) {
			ENotificationImpl notification = new ENotificationImpl(this, Notification.SET, ModelPackage.SERIES_PACK_SERIE__SERIE, oldSerie, newSerie);
			if (msgs == null) msgs = notification; else msgs.add(notification);
		}
		return msgs;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setSerie(Serie newSerie) {
		if (newSerie != serie) {
			NotificationChain msgs = null;
			if (serie != null)
				msgs = ((InternalEObject)serie).eInverseRemove(this, ModelPackage.SERIE__SERIES_PACK_SERIE, Serie.class, msgs);
			if (newSerie != null)
				msgs = ((InternalEObject)newSerie).eInverseAdd(this, ModelPackage.SERIE__SERIES_PACK_SERIE, Serie.class, msgs);
			msgs = basicSetSerie(newSerie, msgs);
			if (msgs != null) msgs.dispatch();
		}
		else if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, ModelPackage.SERIES_PACK_SERIE__SERIE, newSerie, newSerie));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseAdd(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ModelPackage.SERIES_PACK_SERIE__SERIE:
				if (serie != null)
					msgs = ((InternalEObject)serie).eInverseRemove(this, ModelPackage.SERIE__SERIES_PACK_SERIE, Serie.class, msgs);
				return basicSetSerie((Serie)otherEnd, msgs);
		}
		return super.eInverseAdd(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public NotificationChain eInverseRemove(InternalEObject otherEnd, int featureID, NotificationChain msgs) {
		switch (featureID) {
			case ModelPackage.SERIES_PACK_SERIE__SERIE:
				return basicSetSerie(null, msgs);
		}
		return super.eInverseRemove(otherEnd, featureID, msgs);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case ModelPackage.SERIES_PACK_SERIE__SERIE:
				if (resolve) return getSerie();
				return basicGetSerie();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case ModelPackage.SERIES_PACK_SERIE__SERIE:
				setSerie((Serie)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case ModelPackage.SERIES_PACK_SERIE__SERIE:
				setSerie((Serie)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case ModelPackage.SERIES_PACK_SERIE__SERIE:
				return serie != null;
		}
		return super.eIsSet(featureID);
	}

} //SeriesPackSerieImpl
